/*
 * @(#) $CVSHeader:  $
 *
 * Copyright (C) 2010 by Netcetera AG.
 * All rights reserved.
 *
 * The copyright to the computer program(s) herein is the property of
 * Netcetera AG, Switzerland.  The program(s) may be used and/or copied
 * only with the written permission of Netcetera AG or in accordance
 * with the terms and conditions stipulated in the agreement/contract
 * under which the program(s) have been supplied.
 *
 * @(#) $Id: MarkedFeedListAdapter.java 91 2010-07-11 18:03:22Z lpancevski $
 */
package com.dreamcode.anfeedreader.collectors;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dreamcode.anfeedreader.activity.R;
import com.dreamcode.anfeedreader.modelClass.FeedItem;


public class MarkedFeedListAdapter extends BaseAdapter {

  private List<FeedItem> feedItems = null;
  private Context ctx = null;
  
  public MarkedFeedListAdapter(Context ctx, List<FeedItem> feedItems) {
     this.feedItems = feedItems;
     this.ctx = ctx;
  }
  
  @Override
  public int getCount() {
    return feedItems.size();
  }

  @Override
  public Object getItem(int pos) {
    // TODO Auto-generated method stub
    return feedItems.get(pos);
  }

  @Override
  public long getItemId(int i) {
    // TODO Auto-generated method stub
    return 0;
  }

  @Override
  public View getView(int position, View view, ViewGroup viewgroup) {
    final LinearLayout lView = new LinearLayout(ctx);
    lView.setId((feedItems.get(position)).getId());
    lView.setMinimumHeight(25);
    lView.setGravity(Gravity.CENTER_VERTICAL);
    /*RadioButton radioItem = new RadioButton(ctx);
    radioItem.setText((categoryList.get(position)).getGroupName());*/
    TextView tView = new TextView(ctx);
    tView.setText((feedItems.get(position)).getTitle());
    tView.setGravity(Gravity.CENTER_VERTICAL);
    tView.setBackgroundResource(R.drawable.bg_color5);
    tView.setTextColor(Color.BLACK);                
    tView.setMinHeight(30);
    tView.setWidth(300);
    lView.addView(tView);
    return lView;
  }

}
